﻿<%@ page contentType="text/html;charset=UTF-8" isELIgnored="true" autoFlush="true"%>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
<div>
<p style="font-size:13pt;font-weight:bold;text-align:left;height:26px;padding:4 0 0 0;">为了使用本网站的更多功能,请注册</p>
<p>已经注册?   <html:link action="userlogin" styleClass="login">这里登录</html:link>&nbsp;&nbsp;&nbsp;用户注册<%=com.mr.qa.GlobalConfigs.HOURS_ADDQUESTION_AFTER_REGISTRATION%>小时后才能发帖子,但是可以回复</p>
</div>
<table class="qlist" width="100%" align="center" cellpadding="0" cellspacing="0" style="background-color:#FAFCFC;border:1px solid #ccc;">
    <html:form action="/user" method="post" onsubmit="return validate(this);" focus="loginName">
    <html:hidden property="action" value="add"/>
    <tr>
        <td align="right">登录名</td>
        <td>
            <html:text property="loginName" size="12" maxlength="12" style="width:120px;border:1px solid #7F9DB9;margin:0 0 0 0px;"/>*(4-12个字符,一个中文算2个英文字符)&nbsp;&nbsp;&nbsp;&nbsp;<html:link page="/user.mrqa?action=checkloginnameifexist" target="checkloginnameifexist" onclick="return checkLoginName(this);">检查登陆名是否占用</html:link>
            <iframe src="" name="checkloginnameifexist" height="1" scrolling="no" frameborder="0" width="1"></iframe>
        </td>
    </tr> 
    <tr>
        <td align="right">密码</td>
        <td>
            <html:password property="password" size="12" maxlength="12" style="width:120px;border:1px solid #7F9DB9;margin:0 0 0 0px;"/>*(6-12个字符（包括数字,_）)
        </td>
    </tr> 
    <tr>
        <td align="right">密码验证</td>
        <td>
            <input type="password" name="password1" size="12" maxlength="12" style="width:120px;border:1px solid #7F9DB9;margin:0 0 0 0px;"/>*(必须和[密码]相同)
        </td>
    </tr> 
    <tr>
        <td align="right">密码提示</td>
        <td>
            <html:text property="passwordQuestion" size="12" maxlength="12" style="width:120px;border:1px solid #7F9DB9;margin:0 0 0 0px;"/>*(密码提示，可以帮助找回密码。如：我的单位)
        </td>
    </tr> 
    <tr>
        <td align="right">密码答案</td>
        <td>
            <html:text property="passwordAnswer" size="12" maxlength="12" style="width:120px;border:1px solid #7F9DB9;margin:0 0 0 0px;"/>*(如：花旗。找回密码的时候根据系统提示的【密码答案】输入【密码答案】，可以找回密码)
        </td>
    </tr> 
    <tr>
        <td align="right">名称</td>
        <td>
            <html:text property="name" size="20" maxlength="20" style="width:120px;border:1px solid #7F9DB9;margin:0 0 0 0px;"/>
        </td>
    </tr> 
    <tr>
        <td align="right">电子邮件</td>
        <td>
            <html:text property="email" size="50"/>*&nbsp;&nbsp;<html:checkbox property="isEmailPublic"/>是否公开&nbsp;&nbsp;&nbsp;&nbsp;<html:link page="/user.mrqa?action=checkemailexist" target="checkemailexist" onclick="return checkEmailExit(this);">检查电子邮件是否占用</html:link>
            <iframe src="" name="checkemailexist" height="1" scrolling="no" frameborder="0" width="1"></iframe>
            <br>(【电子邮件】地址必须唯一；要保证邮件地址的有效性，以后可以方便地找回密码)
        </td>
    </tr>
    <tr>
        <td align="right">用户类型</td>
        <td>
            <table width="100%" align="center" cellpadding="0" cellspacing="1" style="border:1px dotted #ccc;">
                <tr>
                    <td width="40">&nbsp;</td>
                    <td><input type="radio" name="group" value="AP" checked="true"/><b>Application Programmer(AP)</b></td>
                    <td><input type="radio" name="group" value="SP"/><b>System Programmer(SP)</b></td>
                    <td><input type="radio" name="group" value="BA"/><b>Business Analyst(BA)</b></td>
                </tr>
                <tr>
                    <td valign="top">
                        <p>一级 0-1000</p>
                        <p>二级 1001-3000</p>
                        <p>三级 3001-6000</p>
                        <p>四级 6001-10000</p>
                        <p>五级 10001-20000</p>
                        <p>六级 20001</p>
                    </td>
                    <td valign="top">
                        <p>&nbsp;&nbsp;&nbsp;&nbsp;Application Engineer</p>
                        <p>&nbsp;&nbsp;&nbsp;&nbsp;Senior Application Engineer</p>
                        <p>&nbsp;&nbsp;&nbsp;&nbsp;Application Architect</p>
                        <p>&nbsp;&nbsp;&nbsp;&nbsp;Application Manager</p>
                        <p>&nbsp;&nbsp;&nbsp;&nbsp;Vice Presiden</p>
                        <p>&nbsp;&nbsp;&nbsp;&nbsp;President</p>
                    </td>
                    <td valign="top">
                        <p>&nbsp;&nbsp;&nbsp;&nbsp;System Engineer</p>
                        <p>&nbsp;&nbsp;&nbsp;&nbsp;Senior System Engineer</p>
                        <p>&nbsp;&nbsp;&nbsp;&nbsp;System Specialist</p>
                        <p>&nbsp;&nbsp;&nbsp;&nbsp;System Manager</p>
                        <p>&nbsp;&nbsp;&nbsp;&nbsp;Vice President</p>
                        <p>&nbsp;&nbsp;&nbsp;&nbsp;President</p>
                    </td>
                    <td valign="top">
                        <p>&nbsp;&nbsp;&nbsp;&nbsp;Business Analyst</p>
                        <p>&nbsp;&nbsp;&nbsp;&nbsp;Senior Business Analyst</p>
                        <p>&nbsp;&nbsp;&nbsp;&nbsp;Business Consultant</p>
                        <p>&nbsp;&nbsp;&nbsp;&nbsp;Business Manager</p>
                        <p>&nbsp;&nbsp;&nbsp;&nbsp;Vice President</p>
                        <p>&nbsp;&nbsp;&nbsp;&nbsp;President</p>
                    </td>
                </tr>
            </table>
        </td>
    </tr>
    <tr>
        <td align="right">移动电话</td>
        <td>
            <html:text property="mobile" size="12"/>(没有重复注册的【移动电话可】作为登录名用于登录系统)
        </td>
    </tr> 
   <tr>
        <td align="right">签名</td>
        <td>
            <html:text property="signature" size="50" maxlength="38"/>(个性/心情)
        </td>
    </tr>
    <tr>
        <td align="right">验证码</td>
        <td>
            <input type="text" name="vc" value="" size="8">*(输入右边图片上的数字)<img src="<%=request.getContextPath()%>/vcimg" width="40" height="20" border="0"/>
        </td>
    </tr>
    <tr>
        <td align="right">&nbsp;</td>
        <td>
            <input type="submit" value="提交注册" name="submitButt"/>
        </td>
    </tr>
    
    </html:form>
</table>

<script type="text/javascript">
	//var userId;
    function validate(pForm)
    {
        var loginName = pForm.loginName.value;
        if(loginName == "" || loginName.gblen() < 4)
        {
            alert("[登陆名]必须，且不小于4位");
            pForm.loginName.focus();
            return false;        
        }
        if(loginName.gblen() > 12)
        {
            alert("[登陆名]必须小于12英文字符,一个中文算2个英文字符");
            pForm.loginName.focus();
            return false;
        }
        var errorMessage = "[登陆名]不能含有,;:<>?/~`'\\|+*"+'"';
        if(loginName.indexOf(",") >= 0)
        {
            alert(errorMessage);
            pForm.loginName.focus();
            return false;        
        }
        if(loginName.indexOf(";") >= 0)
        {
            alert(errorMessage);
            pForm.loginName.focus();
            return false;        
        }
        if(loginName.indexOf("'") >= 0)
        {
            alert(errorMessage);
            pForm.loginName.focus();
            return false;        
        }
        if(loginName.indexOf('"') >= 0)
        {
            alert(errorMessage);
            pForm.loginName.focus();
            return false;        
        }
        if(loginName.indexOf("<") >= 0)
        {
            alert(errorMessage);
            pForm.loginName.focus();
            return false;        
        }
        if(loginName.indexOf(">") >= 0)
        {
            alert(errorMessage);
            pForm.loginName.focus();
            return false;        
        }
        if(loginName.indexOf("/") >= 0)
        {
            alert(errorMessage);
            pForm.loginName.focus();
            return false;        
        }
        if(loginName.indexOf('\\') >= 0)
        {
            alert(errorMessage);
            pForm.loginName.focus();
            return false;        
        }
        if(loginName.indexOf(":") >= 0)
        {
            alert(errorMessage);
            pForm.loginName.focus();
            return false;        
        }
        if(loginName.indexOf("`") >= 0)
        {
            alert(errorMessage);
            pForm.loginName.focus();
            return false;        
        }
        if(loginName.indexOf("~") >= 0)
        {
            alert(errorMessage);
            pForm.loginName.focus();
            return false;        
        }
        if(loginName.indexOf("|") >= 0)
        {
            alert(errorMessage);
            pForm.loginName.focus();
            return false;        
        }
        if(loginName.indexOf("+") >= 0)
        {
            alert(errorMessage);
            pForm.loginName.focus();
            return false;        
        }
        var password = pForm.password.value;
        if(password == "" || password.length < 6)
        {
            alert("[密码]必须，且不小于6位");
            pForm.password.focus();
            return false;        
        }
        var password1 = pForm.password1.value;
        if(password != password1)
        {
            alert("[密码]和[验证密码]必须相同");
            pForm.password1.focus();
            return false;        
        }
        var passwordQuestion = pForm.passwordQuestion.value;
        if(passwordQuestion == "")
        {
            alert("[密码提示]必须输入");
            pForm.passwordQuestion.focus();
            return false;        
        }
        var passwordAnswer = pForm.passwordAnswer.value;
        if(passwordAnswer == "")
        {
            alert("[密码答案]必须输入");
            pForm.passwordAnswer.focus();
            return false;        
        }
        
        var email = pForm.email.value;
        if(email == "")
        {
            alert("[电子邮件]必须输入");
            pForm.email.focus();
            return false;        
        }
        var reg = /^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+$/;   
  			if(!reg.test(email)){
  					alert("[电子邮件]格式不正确");
            pForm.email.focus();
            return false;        
  			}
        var vc = pForm.vc.value;
        if(vc == "" || vc.length < 4)
        {
            alert("[验证码]必须输入");
            pForm.vc.focus();
            return false;        
        }
        pForm.submitButt.value = "正在提交...";
        pForm.submitButt.disabled = true;
        return true;
    }
    /**
    *check whether the login name is occupied
    */
    
    function checkLoginName(pLink)
    {
        if(document.user.loginName.value == "")
        {
            alert("请输入登陆名！");return false;
        }
        var link = "<%=request.getContextPath()%>/user.mrqa?action=checkloginnameifexist";
        pLink.href =link+"&loginName="+document.user.loginName.value;
        return true;
    }
    function checkEmailExit(pLink)
    {
    		if(document.user.email.value == "")
        {
            alert("请输入地子邮件！");return false;
        }
        var link = "<%=request.getContextPath()%>/user.mrqa?action=checkemailexist";
        pLink.href = link+"&loginName="+document.user.email.value;
        return true;
    }
    String.prototype.gblen = function()
    {
        var len = 0;
        for (var i=0; i<this.length; i++) {
            if (this.charCodeAt(i)>127 || this.charCodeAt(i)==94) {
                len += 2;
            } else {
                len ++;
            }
        }
        return len;
    }
</script>